package main

import (
	"github.com/kataras/iris"
	"github.com/kongyixueyuan.com/kongyixueyuan/web/initapp"
	"github.com/kongyixueyuan.com/kongyixueyuan/web/initdatabase"
	"github.com/kongyixueyuan.com/kongyixueyuan/web/route"
	"github.com/kongyixueyuan.com/kongyixueyuan/webconfig"
	"github.com/spf13/pflag"
	"log"
)

func main() {

	//service.NewServiceSetup(initfabric.NewChannelClient().Client)
	// 测试用例
	//test_example.Example()
	cfg := initapp.ConfigConst()
	pflag.Parse()
	if err := webconfig.Init(cfg); err != nil {
		panic(err)
	}
	initdatabase.InitDB()
	app := initapp.NewApp()
	route.InitRouter(app)
	err := app.Run(iris.Addr(":80"), iris.WithConfiguration(iris.YAML("./iris.yaml")))
	if err != nil {
		log.Fatal(err)
	}

}

//  docker-compose down
//  rm -rf /tmp/kongyixueyuan-*
//  docker rm -f -v `docker ps -a --no-trunc | grep "kongyixueyuan" | cut -d ' ' -f 1` 2>/dev/null
//  docker rmi `docker images --no-trunc | grep "kongyixueyuan" | cut -d ' ' -f 1` 2>/dev/null
//~{"selector":{"docType":"eduObj","Cer"张三"}}
//GET_QUERY_RESULT failed: transaction ID: b7e0221bf17915e9aa84dffbd79842fb711406fc6b9abe8ad5f0ef093e4ca322: ExecuteQuery not supported for leveldb

/*
docker run -p 5984:5984 -d --name couchdb0 -e COUCHDB_USER=admin -e COUCHDB_PASSWORD=password -v ~/fabric/couchdb0:/opt/couchdb/data klaemo/couchdb
*/
